<?
if(!defined ('U_MOD'))
{
	echo"<meta http-equiv='refresh' content='0;url=/index.php'>";
	exit;
}

function CheckAuthAndRrights($auth, $rights, $module, $module_type)
{
	global $PortalPref;
	$acces=false;
	$query_add='';

//	$modulesTitle
	$rightSelect='modules_'.$module_type.'_right';
	$activeSelected='modules_'.$module_type.'_active';


	if ($rights!=0)
		$query_add="AND ".$activeSelected."='1'";

	$query=mysql_query("SELECT ".$rightSelect." FROM ".$PortalPref."modules WHERE modules_key='".$module."' ".$query_add."");
	if (mysql_num_rows($query)==1)
	{
		$result=mysql_fetch_array($query);



		if ($result[$rightSelect]>=$rights)
			$acces=true;
	}

	return $acces;
}

?>